<html>
<head>
<title>生产管理信息系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {
	background-image: url(images/yodaoskin.png);
	background-repeat: repeat-x;
}
.INPUT {BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 1px; PADDING-LEFT: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #cccccc; PADDING-BOTTOM: 1px; BORDER-TOP-COLOR: #cccccc; PADDING-TOP: 1px; FONT-FAMILY: tahoma; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #cccccc}
.STYLE3 {color: #000040; font-size: 12px; font-weight: bold; }
-->
</style>
<script type="text/javascript">
var XMLHttpObj = {
    _objPool: [],
    _getInstance: function (){
        return this._createObj();
    },

    _createObj: function (){
        if (window.XMLHttpRequest){ //Mozilla
            var objXMLHttp = new XMLHttpRequest();
        }else{                      //IE
            var MSXML = ['MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
            for(var n = 0; n < MSXML.length; n ++){
                try{
                    var objXMLHttp = new ActiveXObject(MSXML[n]);
                    break;
                }
                catch(e){
                }
            }
         }

        if (objXMLHttp.readyState == null){
            objXMLHttp.readyState = 0;

            objXMLHttp.addEventListener("load", function (){
                    objXMLHttp.readyState = 4;
                    if (typeof objXMLHttp.onreadystatechange == "function"){
                        objXMLHttp.onreadystatechange();
                    }
                },  false);
        }
        return objXMLHttp;
    },

    sendAsyncRequest: function (method, url, callback ,parameter, data){
       this._sendRequest(method, url, true,callback ,parameter, data);
    },

    _sendRequest: function (method, url, async, callback, parameter, data){
        var objXMLHttp = this._getInstance();
        with(objXMLHttp){
            try{//no cache
                if (url.indexOf("?") > -1){
                    url += "&randnum=" + Math.random();
                }else{
                    url += "?randnum=" + Math.random();
                }

                open(method, url, async);

                //set charset
                setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');

                if (typeof(data)!="undefined" && data!=""){
                  send(data);
                }else{
                  send(null);
                }

                if (typeof(callback)!="undefined" && callback!=""){
                  onreadystatechange = function (){
                      if (objXMLHttp.readyState == 4 && (objXMLHttp.status == 200 || objXMLHttp.status == 304)){
                          callback(objXMLHttp,parameter);
                      }else{
                    	  //alert("Error@"+objXMLHttp.readyState);
		              }
                  }
                }
            }catch(e){
            	alert("处理 AJAX 请求失败。。。");
            }
        }
    }
};

function $(id){
	return document.getElementById(id);
}

function initLoginForm(){
  $("usercode").value='admin';
  $("userpwd").value='123456';
  $("usercode").focus();
}

function chekLogin(){
	if($("usercode").value == ''){
	     alert("请输入用户名 ");
	     $("usercode").focus();
	     return false;
	}else if($("userpwd").value == ''){
	     alert("请输入密码 ");
	     $("userpwd").focus();
	     return false;
	}else{
	  return true;
	}
}

function callback(objXMLHttp) {
	var responseText = objXMLHttp.responseText;
    try{
        var json = eval("("+responseText+");");
        var uservo=json.dataset.uservo;
        if(uservo.id==undefined || uservo.id==""){
    	    $("userpwd").value='';
    	    $("userpwd").focus();
            alert("对不起，您的用户名或密码有误,请重新输入");	
        }else if(uservo.id!=""){
            if(uservo.menuType==='demo'){   //demo时，人为的跳转到 Menu_demo.html 2009-11-01 add by yujunjie
                window.location.href="Menu_demo.html?flag="+Math.round(Math.random()*100000);
            }else{
                window.location.href="Menu.html?flag="+Math.round(Math.random()*100000);
            }
        }else{
            alert("调用后台有误，请与管理员联系");
        }
    }catch(ex){
       alert("调用后台有误，请与管理员联系");
    }
}

function clickLogin(){
    
    //-----------------------------------------------------------------------------------    
    //为demo环境添加，正式环境时，注释此段代码
    //2009-11-01 add by yujunjie for demo
    //-----------------------------------------------------------------------------------    
    //debugger;
    callback({responseText:"{dataset:{uservo:{id:'yujunjie',menuType:'demo'}}}"});
    return;
    
    //-----------------------------------------------------------------------------------    
    //数据库连接 验证登陆信息
    //-----------------------------------------------------------------------------------    
    if(chekLogin()){
        var code=$("usercode").value;
        var pwd=$("userpwd").value;
        var url="../../DataMap?funcname=loginUser&userCode="+code+"&userPwd="+pwd+"&key="+Math.round(Math.random()*100000); 
        XMLHttpObj.sendAsyncRequest("GET",url,callback);
    }
}

window.onload=function(){
	initLoginForm();
}
document.onkeydown=function(){
   if (event.keyCode == 13){
	   $("imgLogin").click();
   }
}
</script>
 
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<p>&nbsp;</p>
<table width="800" height="537" border="0" align="center" cellpadding="0" cellspacing="0" id="__01">
	<tr>
		<td colspan="3">
			<img src="../../support/images/login/ll_01.gif" width="800" height="142" alt=""></td>
	</tr>
	<tr>
		<td colspan="3">
			<img src="../../support/images/login/ll_02.gif" width="800" height="62" alt=""></td>
	</tr>
	<tr>
		<td rowspan="4">
			<img src="../../support/images/login/ll_03.gif" width="497" height="258" alt=""></td>
		<td>
			<img src="../../support/images/login/ll_04.gif" width="260" height="34" alt=""></td>
		<td rowspan="3">
			<img src="../../support/images/login/ll_05.gif" width="43" height="129" alt=""></td>
	</tr>
	<tr>
		<td height="84" background="../../support/images/login/ll_06.gif"><table width="100%" border="0" cellpadding="1" cellspacing="1">
          <tr>
            <td width="32%"><div align="center"><span class="STYLE3">用户名：</span></div></td>
            <td width="68%"><input name="usercode" class="INPUT" id="usercode" size="28" /></td>
          </tr>
          <tr>
            <td height="28"><div align="center" class="STYLE3">密 &nbsp;码：</div></td>
            <td><input name="userpwd" type="password" class="INPUT" id="userpwd" size="28" /></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><a href="#"><img id='imgLogin' style='cursor:hand' onclick="clickLogin()" title="登录本系统" alt="登录本系统" src="../../support/images/login/dl.gif" width="65" height="22" border="0"></a> 
                <a href="#"><img src="../../support/images/login/qx.gif" width="65" height="22" border="0"></a></td>
          </tr>
        </table></td>
	</tr>
	<tr>
		<td>
			<img src="../../support/images/login/ll_07.gif" width="260" height="11" alt=""></td>
	</tr>
	<tr>
		<td colspan="2">
			<img src="../../support/images/login/ll_08.gif" width="303" height="129" alt=""></td>
	</tr>
	<tr>
		<td colspan="3">
			<img src="../../support/images/login/ll_09.gif" width="800" height="75" alt=""></td>
	</tr>
</table>

</body>
</html>


